import java.io.*;
import java.util.Scanner;

public class IOpractice {
    public static void main1(String[] args) throws IOException {
        File file=new File(".\\111.txt");
//        System.out.println(file.getParent());
//        System.out.println(file.getName());
//        System.out.println(file.getPath());
//        System.out.println(file.getAbsolutePath());
//        System.out.println(file.getCanonicalPath());
//        System.out.println(file.exists());
//        System.out.println(file.isDirectory());
//        System.out.println(file.isFile());

        System.out.println(file.createNewFile());
//        System.out.println(file.delete());
        System.out.println(file.list());
        System.out.println(file.mkdir());

//        File file1=new File(file,".\\aaa.txt");
//        File file2=new File(".\\222.txt",".\\bbb.txt");

    }

    public static void main2(String[] args) throws IOException {
        InputStream inputStream=new FileInputStream("111.txt");
        while(true){
            int b=inputStream.read();
            if(b==-1){
                break;
            }
            System.out.printf("%c",b);
        }

    }

    public static void main3(String[] args) throws IOException {
        try(InputStream is=new FileInputStream("111.txt")) {
            byte[] buffer=new byte[1024];
            int len;
            while(true){
                len=is.read(buffer);
                if(len==-1){
                    break;
                }
                for(int i=0;i<len;i++){
                    System.out.printf("%c",buffer[i]);
                }
            }
        }
    }

    public static void main4(String[] args) throws IOException {
        try(InputStream is=new FileInputStream("111.txt")) {
            try(Scanner scanner=new Scanner(is)){
                while(scanner.hasNext()){
                    String s=scanner.next();
                    System.out.println(s);
                }
            }
        }
    }

    public static void main(String[] args) throws IOException {
        try(OutputStream is=new FileOutputStream("111.txt")) {
            is.write('h');
            is.write('e');
            is.write('l');
            is.write('l');
            is.write('o');
            is.write(',');
            is.write('w');
            is.write('o');
            is.write('r');
            is.write('l');
            is.write('d');
            is.flush();
        }
    }
}
